package com.ychs.lawyer.controller;

import com.ychs.lawyer.bean.R;
import com.ychs.lawyer.bean.User;
import com.ychs.lawyer.service.UserSevice;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: clh
 * @Date: 2024/07/25/16:09
 * @Description:
 */
@Api(tags = "登录接口")
@RestController
@Slf4j
public class LoginController {
    @Autowired
    private UserSevice userSevice;

    /**
     * 登录
     */
    @ApiOperation("登录接口")
    @PostMapping("/login")
    public R<Map<String,Object>> login(@RequestBody User user) {
        log.info("{}:",user.getUserName());
        Map<String,Object> map = userSevice.login(user);
        return R.success(map);
    }
}
